<template>
  <div>
    <h4>Child1</h4>
    <input type="text" :value="modelValue" @input="emits('update:modelValue' , ($event.target as EventTarget).value)">
    <button @click="emits('update:count' , count + 1)">累加{{count}}</button>
  </div>
</template>

<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  name: "Child1",
});
</script>

<script lang="ts" setup>
//props接收
const props = defineProps<{
  modelValue: string
  count: number
}>()

//emits接收
const emits = defineEmits<{
  (event: "update:modelValue" , $event: string):void
  (event: "update:count" , $event: number):void
}>()
</script>
